# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageSignal do
  @moduledoc """
  The set of all usage signals that Data Catalog stores. Note: Usually, these signals are updated daily. In rare cases, an update may fail but will be performed again on the next day.

  ## Attributes

  *   `commonUsageWithinTimeRange` (*type:* `%{optional(String.t) => GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1CommonUsageStats.t}`, *default:* `nil`) - Common usage statistics over each of the predefined time ranges. Supported time ranges are `{"24H", "7D", "30D", "Lifetime"}`.
  *   `favoriteCount` (*type:* `String.t`, *default:* `nil`) - Favorite count in the source system.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - The end timestamp of the duration of usage statistics.
  *   `usageWithinTimeRange` (*type:* `%{optional(String.t) => GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageStats.t}`, *default:* `nil`) - Output only. BigQuery usage statistics over each of the predefined time ranges. Supported time ranges are `{"24H", "7D", "30D"}`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :commonUsageWithinTimeRange =>
            %{
              optional(String.t()) =>
                GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1CommonUsageStats.t()
            }
            | nil,
          :favoriteCount => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :usageWithinTimeRange =>
            %{
              optional(String.t()) =>
                GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageStats.t()
            }
            | nil
        }

  field(:commonUsageWithinTimeRange,
    as: GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1CommonUsageStats,
    type: :map
  )

  field(:favoriteCount)
  field(:updateTime, as: DateTime)

  field(:usageWithinTimeRange,
    as: GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageStats,
    type: :map
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageSignal do
  def decode(value, options) do
    GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageSignal.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DataCatalog.V1beta1.Model.GoogleCloudDatacatalogV1UsageSignal do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
